﻿using FairyGUI;
using FairyGUI.Utils;
using System.Collections.Generic;

public class EmojiParser : UBBParser
{
    static EmojiParser _instance;
	private EmojiParser()
	{
	}
	public new static EmojiParser inst
    {
        get
        {
            if (_instance == null)
                _instance = new EmojiParser();
            return _instance;
        }
    }
	//private List<string> TAGS = new List<string>();
	private string package = "";
	public void Clear()
	{
		handlers.Clear();
	}
	public void AddEmoji(string package, string name)
	{
		this.package = package;
		if (!handlers.ContainsKey(name))
		{
			handlers[":" + name] = OnTag_Emoji;
		}
	}
        //{ "img_biaoqing_1","am","bs","bz","ch","cool","dhq","dn","fd","gz","han","hx","hxiao","hxiu" };

    string OnTag_Emoji(string tagName, bool end, string attr)
    {
        return "<img src='" + UIPackage.GetItemURL(package, tagName.Substring(1).ToLower()) + "'/>";
    }
}